<%--
  Created by IntelliJ IDEA.
  User: haol
  Date: 2017/8/31
  Time: 16:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<base href="<%=basePath%>">
<html lang="zn-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="format-detection" content="telephone=no"/>
    <title>推送详情</title>
    <link rel="stylesheet" href="css/base.css?v=201709071500">
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/base.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
    <script type="text/javascript" src="js/handle.js"></script>
    <script type="text/javascript" src="js/mall_lhx.js"></script>
    <style>
        .hiSlider {
            overflow: hidden;
            width: 500px;
            max-height: 262px;
            /*min-height: 180px;*/
            background: #fff;
        }

        .hiSlider-item {
            float: left;
            width: 100%;
            max-height: 100%;
        }

        .wrap {
            overflow: hidden;
            padding-bottom: 50px;
        }

        .rech_bodybox h5 {
            color: #1b1b1b;
        }

        .rech_bodybox {
            padding: 0 10px;
        }

    </style>
    <link rel="stylesheet" href="js/libs/hiSlider/jquery.hiSlider.css">
    <script type="text/javascript" src="js/libs/hiSlider/jquery.hiSlider.js"></script>
    <script type="text/javascript" src="js/ask.js"></script>
</head>
<body class="ed" style="position:relative">
<div class="wrap">
    <div class="banner">
        <ul class="hiSlider" id="detailPicSlider"></ul>
    </div>
    <h3 class="detail_title"><i id="detaiTitle"></i></h3>
    <div class="detail_content">
        <h4 class="detail_subtitle"><i></i>
            [详情] <span id="mark"></span>
        </h4>
        <div class="rech_bodybox" style="text-align: left;min-height:100px">
            <h5 id="content"></h5>
            <h5 id="officeSite"></h5>
            <h5 id="officeTel"></h5>
        </div>

        <div class="rech_bodybox" style="margin-top: 10px">

        </div>
        </p>
    </div>
    <div class="detail_content">
        <h4 class="detail_subtitle">
            <span></span>
        </h4>
        <p class="detail_text" id="productDetail">
    </div>

    <div class="purchase_box">
        <p>
            <span id='price'></span>
            <%--<i id='orgPrice'></i>--%>
        </p>
        <div class="purchaseBtn" onclick="javascript:wx.closeWindow();">关闭</div>
    </div>
    <div class="toast toast_timeout" style="display:none">网络异常，请稍后重试！</div>
    <div class="toast toast_error" style="display:none">信息输入有误</div>
    <div class="loading" style="display:none">
        <img src="img/loading.gif">
    </div>
</div>

<div class="mall_nodata none">
    <img src="img/mall_nodata.png">
    <p>该信息已删除</p>
</div>
<script type="text/javascript">

    var logoS = $.httpStaticPath() + "common/img/mp/mp_guanzhu_lit.jpg";
    var r = ${result};
    //从自己数据库中取值，所以obj结构不一样
    var obj = r;
    $("#detaiTitle").html(obj.title); //  标题
    $("#content").html(obj.content);
    $("#mark").html();
    if (obj.createTime != '') {
        $("#officeTel").html("推送时间:" + obj.createTime);
    }


    var result = {
        "respCode": "00",
        "object": {
            "description": "http://218.64.54.43:8088/a10c02af-d80f-4712-8abc-0970538da847.png",
            "orgPrice": "MobileGroup",
            "price": "Push",
            "createTime": "20170719201622",
            "brand": "dcvadvav",
            "deleted": "0",
            "picture": "http://111.231.253.134/static/common/img/share_log.png;http://111.231.253.134/static/common/img/share_log2.png",
            "updated": "0",
            "lastUpDateTime": "20170831171426"
        },
        "msg": "success"
    };
    $(function () {
        drawProductDetail(result);
        $('#detailPicSlider').hiSlider({
            isFlexible: true, // 宽度自适应
            isShowControls: false, //是否显示分页按钮
            isAuto: false, //是否自动播放
            isShowTitle: false //是否显示标题栏
        });
    })

    function drawProductDetail(r) {
        var res = r.object;
        if (res.deleted == 1) {
            $(".wrap").addClass('none');
            $(".mall_nodata").removeClass('none');
            return;
        }
        var picArray = res.picture.replace(/\s/, '').split(";");
        var detailArray = res.description.replace(/ /, '').split(";");
        $("#price").html(res.price); // 原价
        $("#orgPrice").html(res.orgPrice); //  现价
        var objp = getParameter("hiSlider");
        if (objp != "") {
            picArray = objp.picture;
            detailArray = objp.description;
        }
        detailArray.push(logoS);
        // 轮播图
        for (var i = 0; i < picArray.length; i++) {
            var p2 = "<li class='hiSlider-item'>";
            p2 += "<img src='" + picArray[i] + "'></li>";
            $("#detailPicSlider").append(p2);
        }
        // 详情图
        for (var j = 0; j < detailArray.length; j++) {
            var p3 = "<img onclick='preImg()' src='" + detailArray[j] + "'>";
            $("#productDetail").append(p3);
        }
    }

    function preImg() {
        wx.previewImage({
            current: logoS, // 当前显示图片的http链接
            urls: [logoS] // 需要预览的图片http链接列表
        });
    }
</script>

<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script type="text/javascript" src="js/weixin.js"></script>
<script type="text/javascript">
    var jsApiList = ['onMenuShareTimeline', 'onMenuShareAppMessage', 'previewImage'];
    $(function () {
        var content = obj.content
        var title = obj.title;
        getSignature(jsApiList, function () {
            shareTempMsgInfo(obj.id, title, content, "${fromUser}", "");
        })
    })
</script>
</body>
</html>